
package com.qdu.servlet;
import com.qdu.entity.Comment;
import com.qdu.service.CommentService;
import com.qdu.service.impl.CommentServiceImpl;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 *
 * @author 12068
 */
@WebServlet("/ddd")
public class AddCommentServlet extends HttpServlet{
    CommentService ss= new CommentServiceImpl();
     @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {


        req.setCharacterEncoding("utf-8");
        int Uno = Integer.parseInt(req.getParameter("Uno"));
        String Uname = req.getParameter("Uname");
        String Ccom = req.getParameter("Ccom");
        int Pno = Integer.parseInt(req.getParameter("Pno"));
    


        Comment newComment = new Comment(Uno,Uname,Ccom,Pno);
        int rows =  ss.addComment(newComment);
     

        resp.getWriter().println(rows);
}
}
